# Table 2

rm(list=ls(all=TRUE))

require(MASS)
require(stargazer)

#### Datasets ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("data_empirics_count_rep.Rdata") 
load("data_empirics_length_rep.Rdata") 

#### MODEL 1.1 - MODEL 1.4: Access to floor (speeches) ####

## MODEL 1.1 ##
model_1.1 <- glm.nb(tot_speeches_leg_cohort ~ female_dum + factor(cohort), 
                     data = data_empirics_count)


## MODEL 1.2 ##
model_1.2 <- glm.nb(tot_speeches_leg_cohort ~ female_dum + ideology_ext + 
                       committee_chair + seniority + type_member + party_match_pres + 
                       negative_lang_mean  +
                       factor(cohort),
                     data = data_empirics_count)

# MODEL 1.3 #
model_1.3 <- glm.nb(length_speech_combined_session ~ female_dum +
                      factor(cohort), 
                    data = data_empirics_length)

# MODEL 1.4 #
model_1.4 <- glm.nb(length_speech_combined_session ~ female_dum + ideology_ext + 
                      committee_chair + seniority + type_member + party_match_pres + 
                      election_year + negative_lang_leg_session +
                      dum_mujeres_session +
                      factor(cohort), 
                    data = data_empirics_length)

#### TABLE 1: Access and length ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Table")

stargazer(model_1.1,model_1.2,model_1.3,model_1.4,
          type = "html", style = "ajps", out = "table2.html",
          covariate.labels = c("Woman","Ideological Extremism","Committee Chair",
                               "Seniority", "National MC", "Same Party as Leg. Pres.",
                               "Mean Negative Language (Debate)",
                               "Election Year", "Negative Language (Speech)",
                               "Topic: Women"),
          omit = "factor",
          no.space=TRUE,
          dep.var.labels=c("Number of Speeches","Length of Speech"),
          digits=3,
          df = FALSE,
          keep.stat = c("theta", "n"))
